﻿using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Text;

namespace NOS.AMF.Message
{
    internal class AMFMessage
    {
        private Collection<AMFHeader> _Headers;
        private Collection<AMFBody> _Bodies;
        private List<AMFResponse> _Response;

        public UInt16 Version { get; set; }

        public Collection<AMFHeader> Headers 
        {
            get
            {
                if (_Headers == null)
                {
                    _Headers = new Collection<AMFHeader>();
                }

                return _Headers;
            }
        }

        public Collection<AMFBody> Bodies 
        {
            get
            {
                if (_Bodies == null)
                {
                    _Bodies = new Collection<AMFBody>();
                }

                return _Bodies;
            }
        }

        public List<AMFResponse> Responses 
        {
            get
            {
                if (_Response == null)
                {
                    _Response = new List<AMFResponse>();
                }

                return _Response;
            }
        }

    }

    internal class AMFHeader
    {
        #region . Contructos .

        public AMFHeader(string Key, bool Required, object Data)
        {
            this.Key = Key;
            this.Required = Required;
            this.Data = Data;
        }

        #endregion

        #region . Public Fields .

        public string Key { get; set; }
        public bool Required { get; set; }
        public object Data { get; set; }

        #endregion
    }

    internal class AMFBody
    {
        private string Method = "";
        private string Type = "";
        private string Target = "";
        private object Data = null;

        public AMFBody(string Method, string Type, string Target, object Data)
        {
            this.Method = Method;
            this.Type = Type;
            this.Target = Target;
            this.Data = Data;
        }
    }

    internal class AMFResponse
    {
        public string ReplyMethod { get; set; }

        public object Data { get; set; }
    }
      
}
